export const POSITIONS = [
    {
        text: "眼镜店",
        value: "1"
    },
    {
        text: "医院",
        value: "2"
    },
    {
        text: "视报中心",
        value: "3"
    },
    {
        text: "学校筛查",
        value: "4"
    },
    {
        text: "渠道",
        value: "5"
    }
]

export const VISIONS = [
    {
        text: "3.0",
        value: 3.0
    },
    {
        text: "3.1",
        value: 3.1
    },
    {
        text: "3.2",
        value: 3.2
    },
    {
        text: "3.3",
        value: 3.3
    },
    {
        text: "3.4",
        value: 3.4
    },
    {
        text: "3.5",
        value: 3.5
    },
    {
        text: "3.6",
        value: 3.6
    },
    {
        text: "3.7",
        value: 3.7
    },
    {
        text: "3.8",
        value: 3.8
    },
    {
        text: "3.9",
        value: 3.9
    },
    {
        text: "4.0",
        value: 4.0
    },
    {
        text: "4.1",
        value: 4.1
    },
    {
        text: "4.2",
        value: 4.2
    },
    {
        text: "4.3",
        value: 4.3
    },
    {
        text: "4.4",
        value: 4.4
    },
    {
        text: "4.5",
        value: 4.5
    },
    {
        text: "4.6",
        value: 4.6
    },
    {
        text: "4.7",
        value: 4.7
    },
    {
        text: "4.8",
        value: 4.8
    },
    {
        text: "4.9",
        value: 4.9
    },
    {
        text: "5.0",
        value: 5.0
    },
    {
        text: "5.1",
        value: 5.1
    },
    {
        text: "5.2",
        value: 5.2
    },
    {
        text: "5.3",
        value: 5.3
    },
]

const generateOptions = (start, end, isFixed, isZeroNegative, valueType = 'string', interval = 1, containZero = true) => {
    const options = [];
    for (let i = start; i <= end; i+=interval) {
        let formatted;
        if (isFixed) {
            if (i < 0) {
                // 负数处理：例如 -5 -> -05
                formatted = `${i.toString().charAt(0)}${Math.abs(i).toString().padStart(2, '0')}`;
            } else {
                // 非负数保持两位格式，如 0 -> 00, 5 -> 05
                formatted = `${i.toString().padStart(2, '0')}`;
            }
        } else {
            formatted = `${i}`
        }

        if (valueType === 'number') {
            formatted = parseInt(formatted);
        }
        if (i === 0) {
            if (isZeroNegative) {
                options.push({
                    text: `-${formatted}`,
                    value: valueType === 'number' ? -formatted : `-${formatted}`
                });
            }
            if (containZero) {
                options.push({
                    text: `${formatted}`,
                    value: valueType === 'number' ? -formatted : `${formatted}`
                });
            }
        } else {
            options.push({
                text: `${formatted}`,
                value: valueType === 'number' ? -formatted : `${formatted}`
            });
        }
    }
    return options;
};

export const SPHERICAL_MIRRORS = [
    // 第一列
    generateOptions(-20, 20, false, false),
    // 第二列
    [
        {text: '00', value: "00"},
        {text: '25', value: "25"},
        {text: '50', value: "50"},
        {text: '75', value: "75"},
    ],
];

export const SPHERICAL_MIRRORS2 = [
    // 第一列
    generateOptions(-6, 0, false, true, "string", 1,  false),
    // 第二列
    [
        {text: '00', value: "00"},
        {text: '25', value: "25"},
        {text: '50', value: "50"},
        {text: '75', value: "75"},
    ],
];

export const AL_OPTIONS = [
    generateOptions(19, 30, false),
    generateOptions(0, 99, true)
]

export const KERATOMETRY = [
    generateOptions(35, 52, false),
    generateOptions(0, 99, true)
]

export const AXIS_POSITIONS = generateOptions(0, 180, false, false, "number", 5)

export const USED_EYES_DURATION = [
    {
        name: "0-1小时",
        key: "1",
    },
    {
        name: "2-3小时",
        key: "2",
    },
    {
        name: "4-5小时",
        key: "3",
    },
    {
        name: "6小时以上",
        key: "4",
    },
]
export const SIT_TYPE = [
    {
        name: "低头读写",
        key: "1",
    },
    {
        name: "歪头读写",
        key: "2",
    },
    {
        name: "握笔过低",
        key: "3",
    },
    {
        name: "存在躺、侧卧用眼",
        key: "4",
    }
]

export const LIGHT_TYPE = [
    {
        name: "夜晚关灯用眼、显示屏等",
        key: "1",
    }
]

export const WEAR_TYPE = [
    {
        name: "戴镜松动",
        key: "1",
    },
    {
        name: "日戴镜不足8小时",
        key: "2",
    }
]
export const ALLERGY = [
    {
        name: "眼或鼻过敏",
        key: "1",
    }
]

export const OUTDOOR_DURATION = [
    {
        name: "0-1小时",
        key: "1",
    },
    {
        name: "2-3小时",
        key: "2",
    },
    {
        name: "4-5小时",
        key: "3",
    },
    {
        name: "6小时以上",
        key: "4",
    },
]


export const GLASSES_TYPE = [
    {
        name: "未戴镜",
        key: "1",
    },
    {
        name: "单光框架眼镜",
        key: "2",
    },
    {
        name: "多焦点框架眼镜",
        key: "3",
    },
    {
        name: "离焦框架眼镜",
        key: "4",
    },
    {
        name: "角膜塑形镜(OK镜)",
        key: "5",
    },
    {
        name: "硬性角膜接触镜(RGP)",
        key: "6",
    },
    {
        name: "离焦软镜",
        key: "7",
    },
    {
        name: "软性角膜接触镜",
        key: "8",
    },
];

export const HABIT = [
    {
        name: "间歇佩戴",
        key: "1",
    },
    {
        name: "日戴小时以上",
        key: "2",
    }
]

export const OVERLAY_MEASURES = [
    {
        name: "阿托品",
        key: "1",
    },
    {
        name: "视觉训练",
        key: "2",
    },
    {
        name: "中医理疗",
        key: "3",
    },
    {
        name: "红光治疗",
        key: "4",
    }
];